import { createSlice } from "@reduxjs/toolkit"

const inistate = [
    {id:1, name:"xiaowen", age:23},
    {id:2, name:"xiaoliu", age:24}
]

const postSlice = createSlice({
    name:"post",
    initialState: inistate,
    reducers:{
        log:state=>{
            console.log(state);
        },
        add:state=>{
            state.push({id:3, name:"zsdlanjd", age:34})
        }
    }
})

export const {log, add} = postSlice.actions

export default postSlice.reducer